﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class demo_ajax : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
        string reStr = docy.str(Request["type"]);
        if (reStr == "zhuangTai")
        {
            //当前用户状态
            zhuangTai();
        }
    }
    void zhuangTai()
    {
        WeiXinData wxData = CheckWXData();
        if(wxData==null)
        {
            Response.Write("没有微信授权成功");
            return;
        }
        else
        {
            Response.Write("昵称:" + wxData.nickName + "<br/>");
            Response.Write("openid:" + wxData.openid + "<br/>");
            Response.Write("图像:" + wxData.imgUrl + "<br/>");
        }
      
    }



    #region 以下为固定代码
    WeiXinData CheckWXData()
    {
        WeiXinData wxData = GetPingTaiWeiXinDataJson();
        return wxData;

    }
    public WeiXinData GetPingTaiWeiXinDataJson()
    {
        if (Session["PingTaiWeiXinData"] == null)
        {
            return null;
        }
        else
        {
            return (WeiXinData)Session["PingTaiWeiXinData"];
        }
    }
    #endregion

}